package com.org.web;

import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JPanel;
import javax.swing.JTextField;

import com.org.api.WebSellService;
import com.org.core.WebSellServiceIml;
import com.org.domain.Produce;
import com.org.domain.WebServiceDTO;
import javax.swing.JTable;

/**
 * ���籱�
 * 
 * @author Andy
 * 
 */
public class WebSellController extends BaseFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private transient WebSellService webSellService = new WebSellServiceIml();

	private WebSellPanel webSellPaenl;

	private WebServiceDTO dto = new WebServiceDTO();
	

	public WebSellController() {

		this.webSellPaenl = new WebSellPanel();
		getContentPane().add(this.webSellPaenl);
		
		
		this.setVisible(true);

		// ��o�ӫ~�M��
		this.webSellPaenl.getGetProduceBtn().addActionListener(
				new ActionListener() {

					@Override
					public void actionPerformed(ActionEvent e) {
						WebSellController.this.getProduceList();

					}
				});

		// �إ߱b��
		this.webSellPaenl.getMakeBillBtn().addActionListener(
				new ActionListener() {

					@Override
					public void actionPerformed(ActionEvent e) {
						// TODO Auto-generated method stub

					}
				});

	}

	/**
	 * �s�W�ӫ~
	 */
	public void AddProduces() {
		this.addFakeProduces(dto);
		this.webSellService.AddProduces(this.dto);
	}

	/**
	 * �[�J�����ӫ~
	 * 
	 * @param dto
	 */
	private void addFakeProduces(WebServiceDTO dto) {
		// �s�W�n�[�J�o�ӫ~
		// TODO

	}

	/**
	 * ��o�ӫ~�M��A����ܦbconsole
	 */
	public void getProduceList() {

		this.webSellService.getProduceList(this.dto);
		this.printProdudces(this.dto.getProduces());

	}

	/**
	 * �إ߱b�沣�X���
	 */
	public void makeBill() {
		this.webSellService.makeBill(this.dto);
		
	}

	/**
	 * �إ߲έp���
	 */
	public void collecBill2MMonthReport() {
		this.webSellService.collecBill2MMonthReport(this.dto);
		
	}

	/**
	 * ��ܰӫ~�M��
	 * 
	 * @param getProduces
	 */
	private void printProdudces(List<Produce> getProduces) {
		// TODO
	}
}
